<%-- 
    Document   : addFriend
    Created on : Jul 12, 2011, 2:43:33 PM
    Author     : northpole
--%>

<%@page import="user.User" contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <%  User userInfo=(User)session.getAttribute("userInfo");//get logged user's info
            if(!userInfo.pendingReq(request.getParameter("username"))){
            userInfo.addFriend(request.getParameter("username"));
            }
     String redirectURL = "profile.jsp?username="+request.getParameter("username").toString();
    response.sendRedirect(redirectURL);
        
%>
        
        <%/*User u=new User();
        String id =request.getParameter("id");
        String username=request.getParameter("username");
        out.print(id);
        out.print(username+" f ");
        u.setId(Integer.parseInt(id));
        String str=session.getAttribute("username").toString();
        out.print(str);
        if(str!=null)
        u.friendReq(str);
        
       String redirectURL = "visitProfile.jsp?username="+request.getParameter("username").toString();
    response.sendRedirect(redirectURL);
        */%>
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>
